package com.gitee.wsl.collections.iterator


class ZipIterator<X, Y>(
    xs: Iterable<X>,
    ys: Iterable<Y>
) : Iterator<Pair<X, Y>> {
    private val xIterator: Iterator<X> = xs.iterator()
    private val yIterator: Iterator<Y> = ys.iterator()


     override fun hasNext(): Boolean {
        return this.xIterator.hasNext() && this.yIterator.hasNext()
    }

     override fun next(): Pair<X, Y> {
        return this.xIterator.next() to  this.yIterator.next()
    }
}
